#ifndef BINARYTREE_H
#define BINARYTREE_H

#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<vector>
#include<stack>
#include<string>
#include<string.h>

using std::vector;
using std::stack;
using std::string;
using std::cout;
using std::endl;

#define END '#'

typedef struct TreeNode
{
	int val;
	TreeNode* left;
	TreeNode* right;
	TreeNode(int x)
		:val(x)
	{}
}TreeNode;

class BinaryTree
{
public:
	BinaryTree(TreeNode* root = nullptr) :mroot(root){}
	~BinaryTree(){}
	void Deserialize(char* str);//用先序序列创建二叉树
	char* Serialize();//将二叉树转化成先序序列
	vector<vector<int>> Print();//之字形打印二叉树
	void ShowTwoVec(vector<vector<int>>& tvec);//打印二维数组
	void ShowBT();//打印先序遍历
private:
	void SerializeDFS(TreeNode* root, string& arr);
	TreeNode* DeserializeDFS(char*& str);
public:
	TreeNode* mroot;
};

#endif